﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GetCustomerDlg.aspx.cs" Inherits="Customer_GetCustomerDlg" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../css/f_css.css" rel="stylesheet" type="text/css" />
    <script language="javascript" src="../js/common.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        function setValue(customerId, customerName) {
            getx("spCustomerName").innerText = customerName;
            getx("hfCustomerID").value = customerId.toString();
        }
        function closeDialog(key, value) {
            if (window.parent.document.onDialogCallBack)
                window.parent.document.onDialogCallBack(1, key, value);
            else
                window.close();
        }
        function onOK() {
            if (getx("hfCustomerID").value) {
                var jsonData = {
                    id: getx("hfCustomerID").value,
                    name: getx("spCustomerName").innerText
                };
                closeDialog("succeed", jsonData);
            }
        }
        function onCancel() {
            if (window.parent.document.onDialogCallBack)
                window.parent.document.onDialogCallBack(0, null, null);
            else
                window.close();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align:center; height:30px; line-height:30px;">
        <asp:Label runat="server" ID="lblMsg" ForeColor="Red" EnableViewState="false"></asp:Label>
    </div>
    <div>
        输入客户名称筛选: <asp:TextBox runat="server" ID="txtCustomerName" CssClass="conint"></asp:TextBox>
        <asp:Button runat="server" ID="btnSearch" Text="查找" CssClass="input00" onclick="btnSearch_Click" />
        <br />
    </div>
    <asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" CssClass="table2"
        DataKeyNames="AID" Width="99%">
        <RowStyle ForeColor="#000066" />
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <a href="javascript:void(0);" onclick='javascript:setValue(<%# Eval("AID") %>, "<%# Eval("Name") %>"); return false;' >选择</a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Name" HeaderText="客户名" />
            <asp:BoundField DataField="Name_En" HeaderText="英文名" />
            <asp:BoundField DataField="IDCode" HeaderText="客户编号" />
            <asp:BoundField DataField="Address" HeaderText="地址" />
            <asp:BoundField DataField="Tel" HeaderText="电话" />
        </Columns>
        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
    </asp:GridView>
    <div>
        已选择: <span id="spCustomerName" style="color:red;">无</span> <input type="hidden" id="hfCustomerID" />
    </div>
    <div style="height:40px; line-height:40px; text-align:center;">
        <input type="button" value="确定" onclick="javascript:onOK();" class="input00" />
        <input type="button" value="取消" onclick="javascript:onCancel();" class="input00" />
    </div>
    </form>
</body>
</html>
